using System.Text;
using System;
using System.Data;
using System.Data.SqlClient;
using BA.DAL;
using BA;

namespace BlazeApps.Library.Options
{
    [Serializable()]
    public class Views
    {
        private BlazeApps.Library.ConfigSettings Config = new BlazeApps.Library.ConfigSettings();
        private BA.DAL.DBUtility DAL = new BA.DAL.DBUtility();
        private Procedures Procs = new Procedures();

        #region " Properties "

        #endregion

        #region " Base Methods "

        public void InsertPageViews(Guid ItemID)
        {
            InsertData(new Criteria(ItemID));
        }

        #endregion

        #region " Criteria "

        [Serializable()]
        private class Criteria
        {
            public Guid ItemID;

            public Criteria(Guid ItemID)
            {
                this.ItemID = ItemID;
            }
        }

        #endregion

        #region " Insert "

        private void InsertData(Criteria CriteriaItems)
        {
            DAL.CreateDBObjects(Config.ConnectionString, Config.Provider);

            AddInsertParameters(ref DAL, CriteriaItems);

            DAL.ExecuteNonQuery(Procs.InsertViews.ToString().Trim(), CommandType.Text, ConnectionState.Open);
        }

        private void AddInsertParameters(ref BA.DAL.DBUtility DAL, Criteria CriteriaItems)
        {
            DAL.AddParameter("@ItemID", CriteriaItems.ItemID);
        }

        #endregion
    }
}
